<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>我买到的商品</title>
    <include file="Pub:style" />
</head>
<body>
    <if condition="empty($list) eq 1">
       <div style="text-align:center;margin-top:20px">您还没有买到商品！</div>
    <else/>
        <volist name="list" id="vo">
            <div class="row" style="margin:5px;">
                <div class="col-xs-12" style="box-shadow: darkgrey 1px 2px 5px 0px;">
                    <div>
                        <div class="usergoodsbox-top">
                            <div class="img"></div>
                            <div class="text">
                                <h3><#$vo.g_name#></h3>
                                <p>￥&nbsp;<#$vo.r_price#></p>
                                <p><#$vo.r_state#></p>
                            </div>
                        </div>
                        <div class="usergoodsbox-footer">
                                <if condition="$vo.r_state eq '未收货'">
                                    <button onclick="queren('<#$vo.id#>')">确认收货</button>
                                    <else />
                                    <button onclick="lookeva('<#$vo.id#>')">查看评价</button>
                                </if>
                        </div>
                    </div>
                </div>
            </div>
        </volist>
    </if>
</body>
<script>
    function queren(rid) {
        $.ajax({
            url:"<#:U('Record/take')#>",
            async:true,
            type:'post',
            data:{rid:rid},
            dataType:'json',
            success:function(res){
                if(res.code==100){
                    document.location.reload()
                    // history.go(-1);
                }else if(res.code==200){
                    layer.msg('操作失败，判断用户是否登录');
                }
            },error:function(res){
                console.log(res)
            }
        })
    }
    function lookeva(rid) {
        document.location.href="__MODULE__/Evaluation/index?rid="+rid;
    }
</script>
</html>